var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(t, e) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);
    })(t, e);
}, function(t, e) {
    function i() {
        this.constructor = t;
    }
    o(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, 
    new i());
}), a = this && this.__decorate || function(t, e, i, o) {
    var n, r = arguments.length, s = r < 3 ? e : null === o ? o = Object.getOwnPropertyDescriptor(e, i) : o;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(t, e, i, o); else for (var c = t.length - 1; 0 <= c; c--) (n = t[c]) && (s = (r < 3 ? n(s) : 3 < r ? n(e, i, s) : n(e, i)) || s);
    return 3 < r && s && Object.defineProperty(e, i, s), s;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("ItemView"), s = cc._decorator, c = s.ccclass, l = s.property, d = function(e) {
    function t() {
        var t = null !== e && e.apply(this, arguments) || this;
        return t.light = null, t.rank = null, t.rankLabel = null, t.idx = 0, t.item = null, 
        t.equip = null, t.christmasItem = null, t.newYearItem = null, t;
    }
    return i(t, e), t.prototype.start = function() {}, t.prototype.isEmpty = function() {
        return null == this.item && null == this.equip && null == this.christmasItem && null == this.newYearItem;
    }, t.prototype.appendItem = function(t) {
        t && (this.item = t, this.item.init(this), this.resumeItem(), this.refresh());
    }, t.prototype.removeItem = function() {
        this.hideRank(), this.item && (this.item.clear(), this.item = null);
    }, t.prototype.resumeItem = function() {
        this.item && (this.item.node.setParent(this.node), this.item.node.setPosition(cc.Vec2.ZERO));
    }, t.prototype.refresh = function() {
        this.item ? (this.item.type == r.GunType.DEFAULT ? this.rankLabel.string = (this.item.rank + 1).toString() : this.rankLabel.string = "∞", 
        this.showRank()) : (this.hideRank(), this.hideLight());
    }, t.prototype.showRank = function() {
        this.rank.active || (this.rank.active = !0);
    }, t.prototype.hideRank = function() {
        this.rank.active && (this.rank.active = !1);
    }, t.prototype.showLight = function() {
        this.light.active || (this.light.active = !0, this.light.opacity = 255, cc.tween(this.light).repeatForever(cc.tween().to(.4, {
            opacity: 100
        }).to(.8, {
            opacity: 255
        })).start(), cc.tween(this.item.node).repeatForever(cc.tween().to(.2, {
            scale: 1.1
        }).to(.2, {
            scale: 1
        }).delay(.8)).start());
    }, t.prototype.hideLight = function() {
        this.light.active && (this.light.active = !1, cc.Tween.stopAllByTarget(this.light), 
        cc.Tween.stopAllByTarget(this.item.node), this.item.node.scale = 1);
    }, a([ l(cc.Node) ], t.prototype, "light", void 0), a([ l(cc.Node) ], t.prototype, "rank", void 0), 
    a([ l(cc.Label) ], t.prototype, "rankLabel", void 0), a([ c ], t);
}(cc.Component);

n.default = d;